using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;

public class DOTweenImage : MonoBehaviour
{
    public Image mImage;
    private Sequence mSequence;
    private int mOldAmount = 0;
    private int mNewAmount = 1;
    
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            ImageAnim();
        }
    }

    void ImageAnim()
    {
        /*mSequence.Append(DOTween.To(delegate(float value)
        {
            mImage.fillAmount = value;
        }, mOldAmount, mNewAmount, 1f));
        //上下两个处理等价*/
        mSequence.Append(DOTween.To(FillAmount, mOldAmount, mNewAmount, 1f));
    }

    void FillAmount(float value)
    {
        mImage.fillAmount = value;
    }
}
